/*
 *  Class name: ChoosableTeamList.java
 *  Version: 1.0
 *  Date: 11.12.2013
 */
package cz.muni.fi.pa165.soccergamesarchive.restclient.gui.components.pageablelist.entity;

import cz.muni.fi.pa165.soccergamesarchive.businesslayer.dtos.TeamDTO;
import cz.muni.fi.pa165.soccergamesarchive.restclient.gui.components.pageablelist.PageableListPanel;
import cz.muni.fi.pa165.soccergamesarchive.restclient.gui.components.pageablelist.items.PageableListItemButton;
import cz.muni.fi.pa165.soccergamesarchive.restclient.gui.components.pageablelist.items.entity.ChooseableTeamListItem;
import cz.muni.fi.pa165.soccergamesarchive.restclient.rest.EntityRestClient;
import cz.muni.fi.pa165.soccergamesarchive.restclient.rest.entity.TeamRestClient;
import java.awt.Dimension;
import java.awt.Window;
import java.util.List;

/**
 *
 * @author Michal Ďuriš
 */
public class ChoosableTeamList extends PageableListPanel<TeamDTO> {

    private static final long serialVersionUID = 1L;

    public ChoosableTeamList() {
        super();
    }

    public ChoosableTeamList(Window owner, String panelTitle) {
        super(owner, panelTitle);
    }

    @Override
    public void init() {
        init(null);
    }

    @Override
    public void init(List<TeamDTO> entityList) {
        initializeList(entityList);

        actionPanel.setPreferredSize(new Dimension(actionPanel
                .getPreferredSize().width, 0));
    }

    @Override
    public PageableListItemButton<TeamDTO> createEntityListItem() {

        ChooseableTeamListItem newItem = new ChooseableTeamListItem(this,
                new TeamDTO());
        newItem.init();

        return newItem;
    }

    @Override
    public PageableListItemButton<TeamDTO> createEntityListItem(TeamDTO entity) {

        ChooseableTeamListItem newItem = new ChooseableTeamListItem(this, entity);
        newItem.init();

        return newItem;
    }

    @Override
    protected EntityRestClient<TeamDTO> getRestClientImplementation() {
        return new TeamRestClient();
    }

    @Override
    protected void handleAddItemAction() {
    }

}
